package cate.game.pvp.gradepvp.msg;

import cate.common.table.d.GDGradePvp;
import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBGradePvp;
import easy.java.dev.note.NoteField;

@ClientMsg(title = "获取战绩 の 请求")
public class GradePvpMarkReq implements MsgInput {
    @NoteField(value = "战绩类型 1.当前赛季 2.总战绩")
    public int type;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        cc.getRole().getPvp().gradePvp.checkOpen();
        if (!cc.getRole().getPvp().gradePvp.isOpen()) {
            game.notice.message(cc.getRole(), "功能未开启");
            return;
        }
        if (type != GDGradePvp.MARK_TYPE_PRESENT && type != GDGradePvp.MARK_TYPE_TOTAL) {
            game.notice.message(cc.getRole(), "错误的战绩类型");
            return;
        }
        cc.sendNow(new GradePvpMarkResp(cc.getRole(), type));
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBGradePvp.MARK_DATA_REQ;
    }
}
